<?php
require_once 'Zend/Form.php';

class Click_Form_Login extends Zend_Form {
    
    public function init() {
        $this->setDecorators(array('FormElements','Form'));        
        
        $this->setAction('/login/authenticate');
        $this->setMethod('post');
        
        $email = new Zend_Form_Element_Text('email', array('disableLoadDefaultDecorators' => true));
        $email->setLabel('E-mail:');
        $email->setOptions(array('size' => '30'));
        $email->setRequired(true);
        $email->addFilter('HtmlEntities');
        $email->addFilter('StringTrim');
        $email->class = 'login';
        $email->addValidator(new Zend_Validate_EmailAddress());
        $email->addDecorators(
            array(
                array('ViewHelper'),
                array('Errors'),
                array('Description', array('tag' => 'p', 'class' => 'description')),   
                array('Label'),
                array(
                    array('data' => 'HtmlTag'),
                    array('tag' => 'p', 'class' => 'login'),            
                )        
            )        
        );
        $this->addElement($email);
        
        $password = new Zend_Form_Element_Password('password', array('disableLoadDefaultDecorators' => true));
        $password->setLabel('Clave:');
        $password->setOptions(array('size' => '30'));
        $password->setRequired(true);
        $password->addFilter('HtmlEntities');
        $password->addFilter('StringTrim');
        $password->class = 'password';
        $password->addDecorators(            
            array(
                array('ViewHelper'),
                array('Errors'),
                array('Description', array('tag' => 'p', 'class' => 'description')),   
                array('Label'),
                array(
                    array('data' => 'HtmlTag'),
                    array('tag' => 'p', 'class' => 'password'),            
                )        
            )        
        );      
        $this->addElement($password); 

        $this->addElement('hidden', 'test', array(
            'description' => '<p class="forgotPassword"><a href="'.$this->getView()->url(array('controller' => 'login', 'action' =>'forgotPassword')).'">¿Olvido su clave? Click aqui</a></p>',
            'ignore' => true,
            'decorators' => array(
                array('Description', array('escape'=>false, 'tag'=>'')),
            ),
        ));
        
        $submit = new Zend_Form_Element_Submit('submit', array('disableLoadDefaultDecorators' => true));
        $submit->setLabel('Entrar');
        $submit->class = 'submit';
        $submit->addDecorators(            
            array(
                array('ViewHelper'),
                array('Errors'),
                array('Description', array('tag' => 'p', 'class' => 'description')),   
                array(
                    array('data' => 'HtmlTag'),
                    array('tag' => 'p', 'class' => 'loginbutton'),        
                )        
            )        
        );
        $this->addElement($submit);        
        
    }

}